package cn.edu.nju.software.cdiy.action.user.login;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import cn.edu.nju.software.cdiy.bean.Hcomment;
import cn.edu.nju.software.cdiy.bean.User;
import cn.edu.nju.software.cdiy.service.impl.HcommentServiceImpl;
import cn.edu.nju.software.cdiy.util.BusinessConstant;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class UserHardwareCommentAction extends ActionSupport implements SessionAware {

	private Map<String, Object> session;
	private HcommentServiceImpl hcommentService;
	private List<Hcomment> commentList;

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public void setHcommentService(HcommentServiceImpl hcommentService) {
		this.hcommentService = hcommentService;
	}

	public List<Hcomment> getCommentList() {
		return commentList;
	}
	
	@Override
	public String execute() throws Exception {
		User user = (User) session.get(BusinessConstant.S_USER);
		commentList = hcommentService.getUserComments(user.getId());
		return SUCCESS;
	}

}
